package com.api.syh56.shengyunhui.entity;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.gitee.sunchenbin.mybatis.actable.annotation.Column;
import lombok.*;
import lombok.experimental.FieldDefaults;

import java.math.BigDecimal;
import java.time.LocalDateTime;

@Data
@FieldDefaults(level = AccessLevel.PRIVATE)
@Builder
@NoArgsConstructor
@AllArgsConstructor
@TableName("coupon")
public class Coupon {

    @Column("id")
    Long id;

    /**
     * 优惠券编号
     * 10 1001
     * 20 1002
     * 50 1003
     * 100 1004
     * 200 1005
     * 500 1006
     */
    @Column(name = "coupon_code",comment = "优惠券编号")
    Short couponCode;

    /**
     * 优惠券类型 0 满减券 1 折扣券
     */
    @Column(name = "coupon_type",comment = "优惠券类型")
    Short couponType;

    /**
     * 折扣金额
     */
    @Column(name = "sum",comment = "折扣金额")
    BigDecimal sum;

    /**
     * 优惠券最低消费金额
     */
    @Column(name = "min_purchase",comment = "优惠券最低消费金额")
    BigDecimal minPurchase;

    /**
     * 优惠券开始时间
     */
    @Column(name = "start_date",comment = "优惠券开始时间")
    LocalDateTime startDate;

    /**
     * 截止日期结束时间
     */
    @Column(name = "end_date",comment = "截止日期结束时间")
    LocalDateTime endDate;

    /**
     * 优惠券总数量
     * 10 (40张)
     * 20 (30张)
     * 50 (20张)
     * 100 (10张)
     * 200 (5张)
     * 500 (2张)
     */
    @Column(name = "total_coupon",comment = "优惠券总数量")
    Integer totalCoupon;

    /**
     * 剩余优惠券数量（有效票数）
     */
    @Column(name = "remaining_coupon",comment = "剩余优惠券数量")
    Integer remainingCoupon;

    /**
     * 优惠券状态 0 无效  1 有效
     */
    @Column(name = "coupon_status",comment = "优惠券状态")
    Short couponStatus;

    @Column(name = "uid")
    Long uid;

    /**
     * 创建时间
     */
    @Column(name = "creation_time")
    @TableField(fill = FieldFill.INSERT)
    LocalDateTime creationTime;

    /**
     * 更新时间
     */
    @Column(name = "last_modification_time",comment = "")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime lastModificationTime;
}
